package com.jk.youxuanmall.member.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jk.youxuanmall.common.pojo.PagedResponse;
import com.jk.youxuanmall.common.utils.PaginationUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.jk.youxuanmall.member.dao.MemberDao;
import com.jk.youxuanmall.member.entity.MemberEntity;
import com.jk.youxuanmall.member.service.MemberService;


@Service("memberService")
public class MemberServiceImpl extends ServiceImpl<MemberDao, MemberEntity> implements MemberService {

    @Autowired
    private MemberDao memberDao;

    @Override
    public PagedResponse<MemberEntity> queryPage(MemberEntity memberEntity, Integer pageNum, Integer pageSize) {
        Page<MemberEntity> page = new Page<>(pageNum, pageSize);
        QueryWrapper<MemberEntity> queryWrapper = new QueryWrapper<>();
        Page<MemberEntity> selectPage = memberDao.selectPage(page, queryWrapper);
        return PaginationUtil.getPaginationResponse(selectPage.getRecords(), pageNum, pageSize, selectPage.getTotal());
    }

}